<template>
	<view class="context">
		<view class="s-tit">{{title}}</view>
		<view class="s-box">
			<view class="s-item" 
				v-for="(item,index) in list" 
				:key="index"><checkbox 
				:checked="item.on == 1" 
				@click="change(item)"/>{{item.name}}</view>
		</view>
	</view>
</template>

<script>
	import goodsCtrl from "../../js/project/GoodsCtrl.js";
	import lang from "../../js/conf/Lang.js";
	export default
	{
		data()
		{
			return{
				title:lang.putOnsaleTxt.title,
				list:[],
			}
		},
		methods:
		{
			initData()
			{
				this.list = goodsCtrl.getPutOnList();
			},
			
			async change(item)
			{
				item.on = item.on ==1 ? 2:1;
				goodsCtrl.putOnChange(item);
				this.initData();
			},
		}
	}
	
</script>

<style lang="scss">
	.context
	{
		font-size: 13px;
		padding-top: 20px;
		padding-bottom: 10px;
		.s-tit
		{
			font-weight: bold;
			
		}
		.s-box
		{
			display: flex;
			flex-wrap: wrap;
			width: auto;

			.s-item
			{
				padding-right: 30px;
				padding-top: 6px;
			}
		}
	}
</style>
